package com.ysre.sheep;

public class Sheep {

    private String name;

    private int defense;

    private boolean alive = true;

    public Sheep(String name,int defense){
        this.name = name;
        this.defense = defense;
    }

    public String getName(){
        return this.name;
    }

    public boolean isAlive(){
        return this.alive;
    }

    public int getDefense(){
        return this.defense;
    }

    public void die(){
        if(!this.alive) {
            throw new RuntimeException(this.name + "早就死球了");
        }
        this.alive = false;
    }

    public String toString(){
        return name + "防御:" + defense + " 存活:" + alive;
    }
}
